import PropTypes from 'prop-types'
import React, { memo } from 'react'
import { SectionFooterWrapper } from './style'
import IconMoreArrow from '@/assets/svg/icon-more-arrow'
import { useNavigate } from 'react-router-dom'

const SectionFooter = memo(({name, type}) => {
  let showMessage = '显示全部'
  if(name) showMessage = `显示更多${name}房源`
  const navigate = useNavigate()
  function clickHandler() {
    navigate(`/entire/${type}`)
  }
  return (
    <SectionFooterWrapper color={name ? "#00848A": "#484848"}>
        <div className='info' onClick={e => clickHandler()}>
            <span className='text'>{showMessage}</span>
            <IconMoreArrow/>
        </div>
    </SectionFooterWrapper>
  )
})

SectionFooter.propTypes = {
    name: PropTypes.string,
    type: PropTypes.string
}

export default SectionFooter